package main.java.hotProd;

import cn.hutool.core.util.StrUtil;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * SalesMapper
 *
 * @author zhangyimin
 * @version 1.0
 * @date 2018-11-07 上午9:41
 */
public class HotProdDataCleanMapper extends Mapper<LongWritable, Text, Text, NullWritable> {


    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
//        13,987,1998-01-10,3,999,1,1232.16
        String[] fields = value.toString().split(",");
        if (fields.length==6&&StrUtil.isNotBlank(fields[2])){
            System.out.println(value);
            context.write(value, NullWritable.get());
        }


    }
}
